home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Apple Shared Library Manager / ASLM Examples / Inspector / Sources / List.cp < prev    next >
Encoding:
Text File  |  1996-11-19  |  3.3 KB  |  193 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        List.cp
  3.  
  4.     Contains:    TList implementation.  A front end to the list manager.
  5.  
  6.     Copyright:    © 1991-1994 by Apple Computer, Inc., all rights reserved.
  7.  
  8. */
  9.  
  10.  
  11. #ifndef __LIST__
  12. #include "List.h"
  13. #endif
  14.  
  15. TList::TList()
  16. {
  17.     fList = NULL;
  18. }
  19.  
  20. TList::TList(const Rect *rView, const Rect *dataBounds, Point cSize,
  21.             short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow,
  22.             Boolean scrollHoriz, Boolean scrollVert)
  23. {
  24.     InitList(rView, dataBounds, cSize, theProc, theWindow, drawIt, hasGrow,
  25.         scrollHoriz, scrollVert);
  26. }
  27.  
  28. TList::~TList()
  29. {
  30.     if (fList)
  31.         LDispose(fList);
  32. }
  33.  
  34. void TList::InitList(const Rect *rView, const Rect *dataBounds, Point cSize,
  35.     short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow,
  36.     Boolean scrollHoriz, Boolean scrollVert)
  37. {
  38.     fList = LNew(rView, dataBounds, cSize, theProc, theWindow, drawIt, hasGrow,
  39.         scrollHoriz, scrollVert);
  40. }
  41.  
  42. short TList::AddColumn(short count,short colNum)
  43. {
  44.     return LAddColumn(count, colNum, fList);
  45. }
  46.  
  47. short TList::AddRow(short count,short rowNum)
  48. {
  49.     return LAddRow(count, rowNum, fList);
  50. }
  51.  
  52. short TList::AddRow(short count)
  53. {
  54.     return LAddRow(count,this->GetLastRow() + 1, fList);
  55. }
  56.  
  57. void TList::DelColumn(short count,short colNum)
  58. {
  59.     LDelColumn(count, colNum, fList);
  60. }
  61.  
  62. void TList::DelRow(short count,short rowNum)
  63. {
  64.     LDelRow(count, rowNum, fList);
  65. }
  66.  
  67. void TList::AddToCell(const void *dataPtr,short dataLen,Cell theCell)
  68. {
  69.     LAddToCell(dataPtr,dataLen,theCell,fList);
  70. }
  71.  
  72. void TList::ClrCell(Cell theCell)
  73. {
  74.     LClrCell(theCell,fList);
  75. }
  76.  
  77. void TList::GetCell(void *dataPtr,short *dataLen,Cell theCell)
  78. {
  79.     LGetCell(dataPtr,dataLen,theCell,fList);
  80. }
  81.  
  82. void TList::SetCell(const void *dataPtr,short dataLen,Cell theCell)
  83. {
  84.     LSetCell(dataPtr,dataLen,theCell,fList);
  85. }
  86.  
  87. void TList::CellSize(Point cSize)
  88. {
  89.     LCellSize(cSize,fList);
  90. }
  91.  
  92. Boolean    TList::GetSelect(Boolean next,Cell *theCell)
  93. {
  94.     return LGetSelect(next,theCell,fList);
  95. }
  96.  
  97. void TList::SetSelect(Boolean setIt,Cell theCell)
  98. {
  99.     LSetSelect(setIt,theCell,fList);
  100. }
  101.  
  102. Boolean    TList::Click(Point pt,short modifiers)
  103. {
  104.     return LClick(pt,modifiers,fList);
  105. }
  106.  
  107. Cell TList::LastClick()
  108. {
  109.     return LLastClick(fList);
  110. }
  111.  
  112. void TList::Find(short *offset,short *len,Cell theCell)
  113. {
  114.     LGetCellDataLocation(offset,len,theCell,fList);
  115. }
  116.  
  117. Boolean    TList::NextCell(Boolean hNext,Boolean vNext,Cell *theCell)
  118. {
  119.     return LNextCell(hNext,vNext,theCell,fList);
  120. }
  121.  
  122. void TList::CellRect(Rect *cellRect,Cell theCell)
  123. {
  124.     LRect(cellRect,theCell,fList);
  125. }
  126.  
  127. Boolean    TList::Search(const void *dataPtr,short dataLen,ListSearchUPP searchProc,
  128.                 Cell *theCell)
  129. {
  130.     return LSearch(dataPtr,dataLen,searchProc,theCell,fList);
  131. }
  132.  
  133. void TList::Size(short listWidth,short listHeight)
  134. {
  135.     LSize(listWidth,listHeight,fList);
  136. }
  137.  
  138. void TList::Draw(Cell theCell)
  139. {
  140.     LDraw(theCell,fList);
  141. }
  142.  
  143. void TList::DoDraw(Boolean drawIt)
  144. {
  145.     LSetDrawingMode(drawIt,fList);
  146. }
  147.  
  148. void TList::Scroll(short dCols,short dRows)
  149. {
  150.     LScroll(dCols,dRows,fList);
  151. }
  152.  
  153. void TList::AutoScroll()
  154. {
  155.     LAutoScroll(fList);
  156. }
  157.  
  158. void TList::Update(RgnHandle theRgn)
  159. {
  160.     LUpdate(theRgn,fList);
  161. }
  162.  
  163. void TList::Activate(Boolean act)
  164. {
  165.     LActivate(act,fList);
  166. }
  167.  
  168. void TList::SetSelFlags(char theFlags)
  169. {
  170.     (**fList).selFlags = theFlags;
  171. }
  172.  
  173. short TList::GetLastRow()
  174. {
  175.     return (**fList).dataBounds.bottom;
  176. }
  177.  
  178. short TList::GetLastColumn()
  179. {
  180.     return (**fList).dataBounds.right;
  181. }
  182.  
  183. ListHandle TList::GetList()
  184. {
  185.     return fList;
  186. }
  187.  
  188. Rect TList::GetListRect()
  189. {
  190.     return (*fList)->rView;
  191. }
  192.  
  193.